#include <iostream>
#include <vector>

using namespace std;

class XThread
{
public:
    virtual void Run() = 0;

    XThread() {}

    ~XThread() { cout << "~XThread" << endl; }
};

class XTask : public XThread
{
public:
    void Run() override {

    };

    ~XTask() { cout << "~XTask" << endl; }
};

int main(int argc, char const *argv[])
{

    XTask task;
    task.Run();

    auto t = new XTask;
    delete t;

    cout << "=============" << endl;

    XThread *t1 = new XTask();
    delete t1;
    
    cout << "这里只调用了 XThread 的析构函数，是错误的，应该要先调用 XTask 的析构函数" << endl;

    cout << "=============" << endl;

    return 0;
}
